package com.wyj;

import com.wyj.mapper.YlrcRoleAuthoritiesMapper;
import com.wyj.mapper.YlrcRoleMapper;
import com.wyj.mapper.YlrcUserMapper;
import com.wyj.pojo.YlrcRoleAuthorities;
import com.wyj.pojo.YlrcUser;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;
import java.util.Map;

/**
 * @author ：wyj
 * @description：TODO
 * @date ：2022/11/18 7:19 下午
 */
@SpringBootTest
public class textOne {

    @Autowired
    YlrcUserMapper ylrcUserMapper;

    @Autowired
    YlrcRoleMapper ylrcRoleMapper;

    @Autowired
    YlrcRoleAuthoritiesMapper ylrcRoleAuthoritiesmapper;

    @Test
    void text01() {
        YlrcUser ylrcUser = ylrcUserMapper.selectById(1);
        System.out.println(ylrcUser);
    }

    //测试角色对应的menu
    @Test
    void text02() {
        List<Map<String, Object>> roleMenus = ylrcRoleMapper.getRoleMenus(1);
        for (Map<String, Object> roleMenu : roleMenus) {
            System.out.println(roleMenu);
        }
    }

    @Test
    void text03() {
        YlrcRoleAuthorities ylrcRoleAuthorities = new YlrcRoleAuthorities();
        ylrcRoleAuthorities.setRoleId(2L);
        ylrcRoleAuthorities.setAuthoritiesId(3L);

        ylrcRoleAuthoritiesmapper.addRoleMenu(ylrcRoleAuthorities);
    }


}
